﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using System.Web.Routing;

namespace QuocHoi_TV_Frontend
{
    public class RouteConfig
    {
        public static void RegisterRoutes(RouteCollection routes)
        {
            routes.IgnoreRoute("{resource}.axd/{*pathInfo}");

            #region BroadCast
            routes.MapRoute(
                name: "BroadCastHome",
                url: "BroadCast",
                defaults: new { controller = "Broadcast", action = "Index" }
            );
            routes.MapRoute(
               name: "ScheduleHome",
               url: "ScheduleTV",
               defaults: new { controller = "Schedule", action = "ScheduleHome" }
            );

            routes.MapRoute(
                name: "ScheduleOfDay",
                url: "ScheduleTV/SessionOfDay",
                defaults: new { controller = "Schedule", action = "SessionOfDay" }
            );
            routes.MapRoute(
                name: "BroadCastList",
                url: "BroadCast/{cate_name}/{cateID}",
                defaults: new { controller = "Broadcast", action = "Detail" }
            );
            routes.MapRoute(
                name: "BroadCastDetail",
                url: "BroadCast/{cate_name}/{news_title}/{newsID}",
                defaults: new { controller = "Broadcast", action = "VideoDetail" }
            );
            routes.MapRoute(
                name: "GetVideoDetail",
                url: "Video/Show",
                defaults: new { controller = "Broadcast", action = "GetVideo" }
            );
            routes.MapRoute(
                name: "PostComment",
                url: "Video/Comment",
                defaults: new { controller = "Broadcast", action = "PostCommnet" }
            );
            #endregion

            #region Lucene Search
            routes.MapRoute(
                name: "SearchPage",
                url: "Search",
                defaults: new { controller = "Search", action = "Index" }
            );

            routes.MapRoute(
                 name: "CreateDataIndex",
                 url: "Search/Process/CreateIndex",
                 defaults: new { controller = "Search", action = "CreateIndex" }
            );
            routes.MapRoute(
                 name: "ClearDataIndex",
                 url: "Search/Process/ClearIndex",
                 defaults: new { controller = "Search", action = "ClearIndex" }
            );
            routes.MapRoute(
                 name: "AddToIndex",
                 url: "Search/Process/AddToIndex",
                 defaults: new { controller = "Search", action = "AddToIndex" }
            );
            routes.MapRoute(
                 name: "ClearIndexRecord",
                 url: "Search/Process/ClearIndexRecord",
                 defaults: new { controller = "Search", action = "ClearIndexRecord" }
            );
            #endregion

            #region Category - News
            routes.MapRoute(
                  name: "Category",
                  url: "{cate_name}/{CategoryId}",
                  defaults: new { controller = "Categories", action = "CategoriesHome" }
            );
            routes.MapRoute(
                 name: "Tag",
                 url: "Tag/{tag_name}/{tagsId}",
                 defaults: new { controller = "News", action = "NewsTag" }
            );
            
            routes.MapRoute(
                name: "CategorySub",
                url: "{cate_name}/{sub_name}/{CategoryId}",
                defaults: new { controller = "Categories", action = "CategoriesHome" }
            );
            routes.MapRoute(
                name: "NewsDetail",
                url: "{cate_name}/{year}/{month}/{news_title}/{newsID}",
                defaults: new { controller = "News", action = "NewsDetailHome" }
            );
            #endregion

            routes.MapRoute(
               name: "ClearCache",
               url: "clear-cache",
               defaults: new { controller = "ClearCache", action = "Index" }
            );

            routes.MapRoute(
                name: "Default",
                url: "{controller}/{action}/{id}",
                defaults: new { controller = "Default", action = "Home", id = UrlParameter.Optional }
            );
        }
    }
}